/**
 *
 */
package jp.seraph.jsade.perceptor;

import org.apache.commons.math.geometry.Vector3D;

import jp.seraph.jsade.sexpression.Node;

/**
 *
 *
 */
public class GyroBuilder implements PerceptorBuilder {

    /**
     *
     * @see jp.seraph.jsade.perceptor.PerceptorBuilder#build(jp.seraph.jsade.sexpression.Node)
     */
    public Perceptor build(Node aNode) {
        String tName = aNode.getValue("n");
        String[] tValues = aNode.getValues("rt");
        if (tName == null || tValues.length != 3)
            throw new IllegalArgumentException("ノードの構造が想定のものと違います。");

        double tX = Double.parseDouble(tValues[0]);
        double tY = Double.parseDouble(tValues[1]);
        double tZ = Double.parseDouble(tValues[2]);
        return new GyroPerceptor("tName", new Vector3D(tX, tY, tZ));
    }
}
